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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: B = None
        self.w: B = None
        self.s: A = None
        self.y: D = None
        self.txt = txt

k = A("k")
c = B("c")
a = C("a")
g = D("g")
j = E("j")
m = F("m")
b = B("b")
e = D("e")

k.u = a
c.y = k
c.w = g
c.r = m
c.t = j
c.v = b
c.u = b
a.z = m
a.v = m
g.p = a
g.x = j
g.y = k
j.y = e
m.o = g
m.y = g
m.t = b
m.w = c
m.s = k
b.y = k
b.w = e
b.r = m
b.t = j
b.v = c
b.u = c
e.p = a
e.x = j
e.y = k
assert a.z.o.p.v.o.y.txt == "
class A:
    def __init__(self, txt: str):
        self.u: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.o: D = None
        self.t: B = None
        self.w: B = None
        self.s: A = None
        self.y: D = None
        self.txt = txt

k = A("k")
c = B("c")
a = C("a")
g = D("g")
j = E("j")
m = F("m")
b = B("b")
e = D("e")

k.u = a
c.y = k
c.w = g
c.r = m
c.t = j
c.v = b
c.u = b
a.z = m
a.v = m
g.p = a
g.x = j
g.y = k
j.y = e
m.o = g
m.y = g
m.t = b
m.w = c
m.s = k
b.y = k
b.w = e
b.r = m
b.t = j
b.v = c
b.u = c
e.p = a
e.x = j
e.y = k
assert a.z.o.p.v.o.y.txt == "k"