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

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

m = A("m")
d = B("d")
l = C("l")
b = D("b")
a = E("a")
f = E("f")
h = C("h")
c = B("c")

m.t = h
m.v = f
m.x = d
d.w = a
d.t = a
d.x = f
l.r = b
l.y = c
l.z = a
l.p = a
b.q = f
a.y = c
f.y = c
h.r = b
h.y = d
h.z = f
h.p = f
c.w = a
c.x = a
c.t = a
assert f.y.x.y.txt == "
class A:
    def __init__(self, txt: str):
        self.t: C = None
        self.v: E = None
        self.x: B = None
        self.txt = txt

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

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

class D:
    def __init__(self, txt: str):
        self.q: E = None
        self.txt = txt

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

m = A("m")
d = B("d")
l = C("l")
b = D("b")
a = E("a")
f = E("f")
h = C("h")
c = B("c")

m.t = h
m.v = f
m.x = d
d.w = a
d.t = a
d.x = f
l.r = b
l.y = c
l.z = a
l.p = a
b.q = f
a.y = c
f.y = c
h.r = b
h.y = d
h.z = f
h.p = f
c.w = a
c.x = a
c.t = a
assert f.y.x.y.txt == "c"