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

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.w: H = None
        self.o: F = None
        self.v: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: G = None
        self.q: A = None
        self.t: A = None
        self.w: G = None
        self.r: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: A = None
        self.z: F = None
        self.u: E = None
        self.r: E = None
        self.txt = txt

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

d = A("d")
k = B("k")
c = C("c")
n = D("n")
f = E("f")
e = F("e")
j = G("j")
g = H("g")

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

class B:
    def __init__(self, txt: str):
        self.p: A = None
        self.txt = txt

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

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

class E:
    def __init__(self, txt: str):
        self.x: D = None
        self.w: H = None
        self.o: F = None
        self.v: G = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: G = None
        self.q: A = None
        self.t: A = None
        self.w: G = None
        self.r: H = None
        self.txt = txt

class G:
    def __init__(self, txt: str):
        self.y: A = None
        self.s: A = None
        self.z: F = None
        self.u: E = None
        self.r: E = None
        self.txt = txt

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

d = A("d")
k = B("k")
c = C("c")
n = D("n")
f = E("f")
e = F("e")
j = G("j")
g = H("g")

d.r = c
d.x = c
k.p = d
c.v = e
c.q = g
n.r = c
f.x = n
f.w = g
f.o = e
f.v = j
e.x = j
e.w = j
e.q = d
e.t = d
e.r = g
j.y = d
j.s = d
j.z = e
j.u = f
j.r = f
g.u = f
g.z = f
assert g.z.o.q.r.txt == "c"