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

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

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

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

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

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

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

e.x = g
e.q = h
j.z = i
j.o = f
f.p = g
m.q = e
m.r = f
h.o = f
h.u = e
i.q = m
i.s = h
g.q = m
g.s = h
assert h.u.q.u.x.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.x: F = None
        self.q: E = None
        self.txt = txt

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

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

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

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

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

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

e.x = g
e.q = h
j.z = i
j.o = f
f.p = g
m.q = e
m.r = f
h.o = f
h.u = e
i.q = m
i.s = h
g.q = m
g.s = h
assert h.u.q.u.x.s.u.txt == "e"