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

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

class C:
    def __init__(self, txt: str):
        self.r: G = None
        self.txt = txt

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

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

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

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

f = A("f")
k = B("k")
b = C("b")
h = D("h")
c = E("c")
g = F("g")
m = G("m")
j = G("j")

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

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

class C:
    def __init__(self, txt: str):
        self.r: G = None
        self.txt = txt

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

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

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

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

f = A("f")
k = B("k")
b = C("b")
h = D("h")
c = E("c")
g = F("g")
m = G("m")
j = G("j")

f.t = b
k.s = c
k.z = h
k.p = h
k.r = f
b.r = j
h.p = c
c.r = g
c.u = g
c.x = g
c.t = g
g.p = b
g.w = b
g.q = c
g.z = j
g.u = j
g.v = h
g.x = k
m.z = g
j.z = g
assert c.t.v.p.x.u.z.q.txt == "c"