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.q: F = None
        self.v: F = None
        self.t: A = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: D = None
        self.txt = txt

g = A("g")
c = B("c")
k = C("k")
a = D("a")
f = E("f")
l = F("l")

g.u = c
g.q = c
c.q = l
c.v = l
c.t = g
k.r = f
k.p = g
k.x = c
a.y = k
f.z = k
f.w = k
f.u = l
f.x = c
l.u = c
l.t = a
assert a.y.p.u.t.q.t.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.q: F = None
        self.v: F = None
        self.t: A = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.u: B = None
        self.t: D = None
        self.txt = txt

g = A("g")
c = B("c")
k = C("k")
a = D("a")
f = E("f")
l = F("l")

g.u = c
g.q = c
c.q = l
c.v = l
c.t = g
k.r = f
k.p = g
k.x = c
a.y = k
f.z = k
f.w = k
f.u = l
f.x = c
l.u = c
l.t = a
assert a.y.p.u.t.q.t.txt == "g"