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

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.q: F = None
        self.w: D = None
        self.txt = txt

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

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

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

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

m = A("m")
c = B("c")
e = C("e")
i = D("i")
k = E("k")
n = F("n")
b = A("b")

m.u = b
c.r = i
c.w = i
c.q = n
e.y = m
i.y = e
i.t = m
k.z = b
k.r = e
k.q = i
n.z = c
b.u = m
assert n.z.q.z.w.y.y.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: A = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.r: D = None
        self.q: F = None
        self.w: D = None
        self.txt = txt

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

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

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

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

m = A("m")
c = B("c")
e = C("e")
i = D("i")
k = E("k")
n = F("n")
b = A("b")

m.u = b
c.r = i
c.w = i
c.q = n
e.y = m
i.y = e
i.t = m
k.z = b
k.r = e
k.q = i
n.z = c
b.u = m
assert n.z.q.z.w.y.y.u.txt == "b"