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

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.r: E = None
        self.v: A = None
        self.t: A = None
        self.txt = txt

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

b.r = c
b.s = h
b.q = h
c.s = n
h.q = c
h.o = n
h.z = k
n.w = k
n.u = h
k.u = g
g.p = k
g.r = k
g.v = b
g.t = b
assert c.s.w.u.txt == "
class A:
    def __init__(self, txt: str):
        self.r: B = None
        self.s: C = None
        self.q: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

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

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

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

class F:
    def __init__(self, txt: str):
        self.p: E = None
        self.r: E = None
        self.v: A = None
        self.t: A = None
        self.txt = txt

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

b.r = c
b.s = h
b.q = h
c.s = n
h.q = c
h.o = n
h.z = k
n.w = k
n.u = h
k.u = g
g.p = k
g.r = k
g.v = b
g.t = b
assert c.s.w.u.txt == "g"