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

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

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

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.s: C = None
        self.v: A = None
        self.z: A = None
        self.txt = txt

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

d = A("d")
n = B("n")
a = C("a")
g = D("g")
f = E("f")
b = C("b")
h = A("h")

d.y = f
d.s = f
d.t = a
d.p = g
n.x = f
a.x = g
a.r = h
a.t = d
a.z = d
g.u = f
g.s = b
g.v = d
g.z = h
f.y = d
f.u = b
f.z = h
b.x = g
b.r = h
b.t = d
b.z = d
h.y = f
h.s = f
h.t = a
h.p = g
assert b.x.u.u.r.txt == "
class A:
    def __init__(self, txt: str):
        self.y: E = None
        self.s: E = None
        self.t: C = None
        self.p: D = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.u: E = None
        self.s: C = None
        self.v: A = None
        self.z: A = None
        self.txt = txt

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

d = A("d")
n = B("n")
a = C("a")
g = D("g")
f = E("f")
b = C("b")
h = A("h")

d.y = f
d.s = f
d.t = a
d.p = g
n.x = f
a.x = g
a.r = h
a.t = d
a.z = d
g.u = f
g.s = b
g.v = d
g.z = h
f.y = d
f.u = b
f.z = h
b.x = g
b.r = h
b.t = d
b.z = d
h.y = f
h.s = f
h.t = a
h.p = g
assert b.x.u.u.r.txt == "h"