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

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

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

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

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

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

g = A("g")
i = B("i")
c = C("c")
j = D("j")
l = E("l")
f = F("f")

g.u = i
g.q = i
i.w = j
i.v = j
i.r = f
i.u = c
i.z = c
i.s = g
c.r = i
c.v = g
j.u = g
j.r = c
j.z = i
l.z = i
f.x = l
assert i.u.v.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.u: B = None
        self.q: B = None
        self.txt = txt

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

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

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

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

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

g = A("g")
i = B("i")
c = C("c")
j = D("j")
l = E("l")
f = F("f")

g.u = i
g.q = i
i.w = j
i.v = j
i.r = f
i.u = c
i.z = c
i.s = g
c.r = i
c.v = g
j.u = g
j.r = c
j.z = i
l.z = i
f.x = l
assert i.u.v.u.u.txt == "c"