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

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: C = None
        self.r: D = None
        self.o: F = None
        self.txt = txt

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

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

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

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

c = A("c")
g = B("g")
a = C("a")
k = D("k")
b = E("b")
h = F("h")

c.u = b
c.o = a
g.p = k
g.r = k
g.s = a
g.o = h
a.o = b
a.z = g
a.p = c
a.s = c
a.q = h
a.r = k
k.x = c
b.x = c
h.y = k
h.z = k
h.v = c
h.u = c
assert c.u.x.u.x.o.q.txt == "
class A:
    def __init__(self, txt: str):
        self.u: E = None
        self.o: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: D = None
        self.s: C = None
        self.r: D = None
        self.o: F = None
        self.txt = txt

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

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

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

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

c = A("c")
g = B("g")
a = C("a")
k = D("k")
b = E("b")
h = F("h")

c.u = b
c.o = a
g.p = k
g.r = k
g.s = a
g.o = h
a.o = b
a.z = g
a.p = c
a.s = c
a.q = h
a.r = k
k.x = c
b.x = c
h.y = k
h.z = k
h.v = c
h.u = c
assert c.u.x.u.x.o.q.txt == "h"