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

class B:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: B = None
        self.txt = txt

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

g = A("g")
l = B("l")
c = C("c")
f = D("f")
j = E("j")
i = F("i")
e = D("e")
b = A("b")

g.z = i
g.t = i
l.s = i
c.z = l
f.x = l
f.z = j
j.r = l
j.x = l
i.q = l
i.p = b
e.x = l
e.z = j
b.z = i
b.t = i
assert b.t.q.s.q.s.q.s.txt == "
class A:
    def __init__(self, txt: str):
        self.z: F = None
        self.t: F = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: F = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.r: B = None
        self.x: B = None
        self.txt = txt

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

g = A("g")
l = B("l")
c = C("c")
f = D("f")
j = E("j")
i = F("i")
e = D("e")
b = A("b")

g.z = i
g.t = i
l.s = i
c.z = l
f.x = l
f.z = j
j.r = l
j.x = l
i.q = l
i.p = b
e.x = l
e.z = j
b.z = i
b.t = i
assert b.t.q.s.q.s.q.s.txt == "i"