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

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

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: B = None
        self.x: E = None
        self.v: F = None
        self.txt = txt

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

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

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

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.y: B = None
        self.z: B = None
        self.x: E = None
        self.v: F = None
        self.txt = txt

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

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

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

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

d.q = j
b.x = h
b.y = n
b.q = j
b.z = j
b.o = j
b.r = k
b.p = c
j.q = b
j.p = n
n.y = b
n.z = b
n.x = k
n.v = f
k.z = c
k.s = n
k.p = m
f.p = d
f.t = c
c.t = h
c.r = k
c.x = f
h.z = c
h.s = n
h.p = m
m.p = d
m.t = c
g.q = j
assert c.r.z.t.s.v.t.x.t.x.txt == "f"