class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.w: D = None
        self.x: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

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

m = A("m")
f = B("f")
h = C("h")
i = D("i")
a = E("a")
k = F("k")

m.u = i
m.w = i
m.x = a
f.u = m
h.u = m
i.o = k
a.p = f
a.x = f
a.s = h
a.q = i
a.t = i
k.z = m
assert f.u.x.s.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.w: D = None
        self.x: E = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.o: F = None
        self.txt = txt

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

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

m = A("m")
f = B("f")
h = C("h")
i = D("i")
a = E("a")
k = F("k")

m.u = i
m.w = i
m.x = a
f.u = m
h.u = m
i.o = k
a.p = f
a.x = f
a.s = h
a.q = i
a.t = i
k.z = m
assert f.u.x.s.u.txt == "m"