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

class B:
    def __init__(self, txt: str):
        self.p: F = None
        self.u: D = None
        self.q: F = None
        self.x: D = None
        self.t: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.p: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.t: A = None
        self.p: B = None
        self.s: D = None
        self.w: C = None
        self.z: F = None
        self.txt = txt

k = A("k")
l = B("l")
f = C("f")
a = D("a")
i = E("i")
e = F("e")
j = C("j")
h = F("h")

k.r = a
l.p = e
l.q = e
l.u = a
l.x = a
l.t = k
f.v = l
f.r = k
f.u = h
f.p = a
a.r = k
i.u = l
i.p = k
e.u = a
e.s = a
e.t = k
e.p = l
e.w = f
e.z = h
j.v = l
j.r = k
j.u = e
j.p = a
h.u = a
h.s = a
h.t = k
h.p = l
h.w = f
h.z = e
assert e.s.r.r.r.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: F = None
        self.u: D = None
        self.q: F = None
        self.x: D = None
        self.t: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.u: B = None
        self.p: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.u: D = None
        self.t: A = None
        self.p: B = None
        self.s: D = None
        self.w: C = None
        self.z: F = None
        self.txt = txt

k = A("k")
l = B("l")
f = C("f")
a = D("a")
i = E("i")
e = F("e")
j = C("j")
h = F("h")

k.r = a
l.p = e
l.q = e
l.u = a
l.x = a
l.t = k
f.v = l
f.r = k
f.u = h
f.p = a
a.r = k
i.u = l
i.p = k
e.u = a
e.s = a
e.t = k
e.p = l
e.w = f
e.z = h
j.v = l
j.r = k
j.u = e
j.p = a
h.u = a
h.s = a
h.t = k
h.p = l
h.w = f
h.z = e
assert e.s.r.r.r.r.txt == "a"