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

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.r: D = None
        self.z: B = None
        self.y: E = None
        self.t: B = None
        self.txt = txt

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

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

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

f = A("f")
n = B("n")
k = C("k")
b = D("b")
c = E("c")
g = F("g")

f.z = k
f.x = k
f.p = g
n.t = k
k.s = n
k.z = n
k.t = n
k.r = b
k.y = c
b.y = n
b.p = n
c.t = n
g.q = b
g.u = b
g.x = n
assert f.z.r.y.t.r.y.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.p: F = None
        self.x: C = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.s: B = None
        self.r: D = None
        self.z: B = None
        self.y: E = None
        self.t: B = None
        self.txt = txt

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

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

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

f = A("f")
n = B("n")
k = C("k")
b = D("b")
c = E("c")
g = F("g")

f.z = k
f.x = k
f.p = g
n.t = k
k.s = n
k.z = n
k.t = n
k.r = b
k.y = c
b.y = n
b.p = n
c.t = n
g.q = b
g.u = b
g.x = n
assert f.z.r.y.t.r.y.txt == "n"