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

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: D = None
        self.q: A = None
        self.o: A = None
        self.u: D = None
        self.w: B = None
        self.txt = txt

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

b = A("b")
c = B("c")
n = C("n")
i = D("i")
h = E("h")
d = F("d")

b.u = c
c.q = b
c.u = b
n.y = c
i.x = h
i.z = h
h.y = i
h.r = i
h.u = i
h.q = b
h.o = b
h.w = c
d.s = h
d.x = h
assert d.x.o.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.y: D = None
        self.r: D = None
        self.q: A = None
        self.o: A = None
        self.u: D = None
        self.w: B = None
        self.txt = txt

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

b = A("b")
c = B("c")
n = C("n")
i = D("i")
h = E("h")
d = F("d")

b.u = c
c.q = b
c.u = b
n.y = c
i.x = h
i.z = h
h.y = i
h.r = i
h.u = i
h.q = b
h.o = b
h.w = c
d.s = h
d.x = h
assert d.x.o.u.u.u.txt == "c"