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

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

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

class D:
    def __init__(self, txt: str):
        self.p: F = None
        self.o: A = None
        self.z: B = None
        self.r: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.s: F = None
        self.u: F = None
        self.w: D = None
        self.txt = txt

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

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

h.x = e
e.x = m
e.s = b
j.t = f
m.p = f
m.o = h
m.z = e
m.r = i
b.r = i
b.u = i
b.s = f
b.w = m
i.p = h
i.v = e
i.q = e
i.w = c
c.t = f
f.p = h
f.v = e
f.q = e
f.w = c
assert m.o.x.s.u.p.x.x.o.txt == "
class A:
    def __init__(self, txt: str):
        self.x: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.p: F = None
        self.o: A = None
        self.z: B = None
        self.r: F = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.r: F = None
        self.s: F = None
        self.u: F = None
        self.w: D = None
        self.txt = txt

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

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

h.x = e
e.x = m
e.s = b
j.t = f
m.p = f
m.o = h
m.z = e
m.r = i
b.r = i
b.u = i
b.s = f
b.w = m
i.p = h
i.v = e
i.q = e
i.w = c
c.t = f
f.p = h
f.v = e
f.q = e
f.w = c
assert m.o.x.s.u.p.x.x.o.txt == "h"