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

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.q: C = None
        self.y: B = None
        self.w: E = None
        self.txt = txt

d = A("d")
b = B("b")
e = C("e")
f = D("f")
n = E("n")
m = C("m")
l = A("l")
h = E("h")

d.r = f
d.x = b
d.t = n
d.p = l
b.z = m
b.u = l
b.r = l
e.y = b
f.y = l
f.p = m
n.o = f
n.q = m
n.y = b
n.w = h
m.y = b
l.r = f
l.x = b
l.t = n
l.p = d
h.o = f
h.q = e
h.y = b
h.w = n
assert b.u.t.q.y.txt == "
class A:
    def __init__(self, txt: str):
        self.r: D = None
        self.x: B = None
        self.t: E = None
        self.p: A = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.o: D = None
        self.q: C = None
        self.y: B = None
        self.w: E = None
        self.txt = txt

d = A("d")
b = B("b")
e = C("e")
f = D("f")
n = E("n")
m = C("m")
l = A("l")
h = E("h")

d.r = f
d.x = b
d.t = n
d.p = l
b.z = m
b.u = l
b.r = l
e.y = b
f.y = l
f.p = m
n.o = f
n.q = m
n.y = b
n.w = h
m.y = b
l.r = f
l.x = b
l.t = n
l.p = d
h.o = f
h.q = e
h.y = b
h.w = n
assert b.u.t.q.y.txt == "b"