class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: D = None
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: B = None
        self.y: D = None
        self.x: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: C = None
        self.v: B = None
        self.p: B = None
        self.txt = txt

j = A("j")
f = B("f")
k = C("k")
b = D("b")
h = B("h")
g = B("g")
d = C("d")
a = D("a")

j.t = a
j.z = b
j.r = f
f.o = g
f.y = a
f.x = b
k.o = d
k.t = a
b.t = j
b.r = k
b.v = g
b.p = f
h.o = f
h.y = a
h.x = b
g.o = h
g.y = b
g.x = b
d.o = k
d.t = a
a.t = j
a.r = d
a.v = h
a.p = g
assert b.p.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: D = None
        self.z: D = None
        self.r: B = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.o: B = None
        self.y: D = None
        self.x: D = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: C = None
        self.t: D = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.t: A = None
        self.r: C = None
        self.v: B = None
        self.p: B = None
        self.txt = txt

j = A("j")
f = B("f")
k = C("k")
b = D("b")
h = B("h")
g = B("g")
d = C("d")
a = D("a")

j.t = a
j.z = b
j.r = f
f.o = g
f.y = a
f.x = b
k.o = d
k.t = a
b.t = j
b.r = k
b.v = g
b.p = f
h.o = f
h.y = a
h.x = b
g.o = h
g.y = b
g.x = b
d.o = k
d.t = a
a.t = j
a.r = d
a.v = h
a.p = g
assert b.p.o.y.txt == "b"