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

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

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.z: D = None
        self.u: D = None
        self.q: C = None
        self.txt = txt

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

g = A("g")
d = B("d")
h = C("h")
a = D("a")
c = C("c")
e = D("e")
l = D("l")
f = A("f")

g.r = f
g.u = f
g.v = e
g.t = d
d.w = a
d.p = h
h.v = l
h.u = l
h.z = a
h.q = c
a.p = f
a.w = f
c.v = l
c.z = e
c.u = e
c.q = h
e.p = f
e.w = g
l.p = f
l.w = f
f.r = g
f.u = g
f.v = l
f.t = d
assert a.p.u.u.t.p.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: A = None
        self.u: A = None
        self.v: D = None
        self.t: B = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.v: D = None
        self.z: D = None
        self.u: D = None
        self.q: C = None
        self.txt = txt

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

g = A("g")
d = B("d")
h = C("h")
a = D("a")
c = C("c")
e = D("e")
l = D("l")
f = A("f")

g.r = f
g.u = f
g.v = e
g.t = d
d.w = a
d.p = h
h.v = l
h.u = l
h.z = a
h.q = c
a.p = f
a.w = f
c.v = l
c.z = e
c.u = e
c.q = h
e.p = f
e.w = g
l.p = f
l.w = f
f.r = g
f.u = g
f.v = l
f.t = d
assert a.p.u.u.t.p.z.txt == "a"