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

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

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

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

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

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

b = A("b")
m = B("m")
h = C("h")
l = D("l")
f = E("f")
k = F("k")
g = D("g")
e = E("e")

b.r = k
m.w = b
m.p = b
h.x = b
l.x = m
f.y = g
f.u = m
f.v = m
f.p = b
f.q = k
f.t = k
k.z = f
k.y = g
k.x = b
k.p = m
g.x = m
e.y = g
e.u = m
e.v = m
e.p = b
e.q = k
e.t = k
assert h.x.r.y.x.p.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.txt = txt

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

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

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

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

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

b = A("b")
m = B("m")
h = C("h")
l = D("l")
f = E("f")
k = F("k")
g = D("g")
e = E("e")

b.r = k
m.w = b
m.p = b
h.x = b
l.x = m
f.y = g
f.u = m
f.v = m
f.p = b
f.q = k
f.t = k
k.z = f
k.y = g
k.x = b
k.p = m
g.x = m
e.y = g
e.u = m
e.v = m
e.p = b
e.q = k
e.t = k
assert h.x.r.y.x.p.txt == "b"