class A:
    def __init__(self, txt: str):
        self.p: G = None
        self.t: D = None
        self.v: D = None
        self.y: C = None
        self.x: E = None
        self.s: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: G = None
        self.s: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.w: C = None
        self.t: G = None
        self.q: D = None
        self.p: H = None
        self.txt = txt

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

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

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

b.p = n
b.t = c
b.v = c
b.y = j
b.x = a
b.s = e
g.u = e
j.t = c
c.s = d
a.q = b
a.z = n
a.s = g
d.z = i
d.q = i
d.w = j
d.t = n
d.p = f
n.z = f
f.r = b
f.p = n
i.s = d
e.u = g
assert f.r.s.u.u.u.txt == "
class A:
    def __init__(self, txt: str):
        self.p: G = None
        self.t: D = None
        self.v: D = None
        self.y: C = None
        self.x: E = None
        self.s: B = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.q: A = None
        self.z: G = None
        self.s: B = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.z: D = None
        self.w: C = None
        self.t: G = None
        self.q: D = None
        self.p: H = None
        self.txt = txt

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

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

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

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