class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: A = None
        self.s: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: C = None
        self.w: C = None
        self.v: A = None
        self.txt = txt

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

h.y = d
n.z = j
a.r = j
a.o = b
a.s = e
f.p = a
f.u = a
f.w = a
f.v = h
e.z = k
j.p = a
j.u = a
j.w = a
j.v = g
d.y = b
b.y = g
g.y = h
k.p = a
k.u = a
k.w = a
k.v = b
assert f.p.r.v.y.y.txt == "
class A:
    def __init__(self, txt: str):
        self.y: A = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.r: D = None
        self.o: A = None
        self.s: B = None
        self.txt = txt

class D:
    def __init__(self, txt: str):
        self.p: C = None
        self.u: C = None
        self.w: C = None
        self.v: A = None
        self.txt = txt

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

h.y = d
n.z = j
a.r = j
a.o = b
a.s = e
f.p = a
f.u = a
f.w = a
f.v = h
e.z = k
j.p = a
j.u = a
j.w = a
j.v = g
d.y = b
b.y = g
g.y = h
k.p = a
k.u = a
k.w = a
k.v = b
assert f.p.r.v.y.y.txt == "d"