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

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: C = None
        self.q: F = None
        self.s: A = None
        self.x: B = None
        self.u: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.r: C = None
        self.u: B = None
        self.s: E = None
        self.txt = txt

i = A("i")
k = B("k")
f = C("f")
h = D("h")
l = E("l")
e = F("e")

i.u = h
k.r = i
k.v = l
k.s = e
k.q = h
f.x = l
h.x = l
l.r = f
l.w = f
l.q = e
l.s = i
l.u = i
l.x = k
e.z = k
e.u = k
e.r = f
e.s = l
assert e.s.x.r.u.x.x.txt == "
class A:
    def __init__(self, txt: str):
        self.u: D = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.r: C = None
        self.w: C = None
        self.q: F = None
        self.s: A = None
        self.x: B = None
        self.u: A = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: B = None
        self.r: C = None
        self.u: B = None
        self.s: E = None
        self.txt = txt

i = A("i")
k = B("k")
f = C("f")
h = D("h")
l = E("l")
e = F("e")

i.u = h
k.r = i
k.v = l
k.s = e
k.q = h
f.x = l
h.x = l
l.r = f
l.w = f
l.q = e
l.s = i
l.u = i
l.x = k
e.z = k
e.u = k
e.r = f
e.s = l
assert e.s.x.r.u.x.x.txt == "k"