class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: E = None
        self.r: F = None
        self.p: C = None
        self.q: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.t: D = None
        self.z: F = None
        self.s: D = None
        self.txt = txt

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

c = A("c")
j = B("j")
m = C("m")
d = D("d")
i = E("i")
h = F("h")
a = D("a")

c.w = i
c.x = i
c.q = i
c.r = h
c.p = m
j.u = m
m.v = h
m.u = c
d.y = a
d.r = i
d.p = i
d.u = m
i.v = j
i.t = a
i.z = h
i.s = d
h.t = m
h.p = d
h.o = j
a.y = d
a.r = i
a.p = i
a.u = m
assert i.z.t.u.p.txt == "
class A:
    def __init__(self, txt: str):
        self.w: E = None
        self.x: E = None
        self.r: F = None
        self.p: C = None
        self.q: E = None
        self.txt = txt

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

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

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

class E:
    def __init__(self, txt: str):
        self.v: B = None
        self.t: D = None
        self.z: F = None
        self.s: D = None
        self.txt = txt

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

c = A("c")
j = B("j")
m = C("m")
d = D("d")
i = E("i")
h = F("h")
a = D("a")

c.w = i
c.x = i
c.q = i
c.r = h
c.p = m
j.u = m
m.v = h
m.u = c
d.y = a
d.r = i
d.p = i
d.u = m
i.v = j
i.t = a
i.z = h
i.s = d
h.t = m
h.p = d
h.o = j
a.y = d
a.r = i
a.p = i
a.u = m
assert i.z.t.u.p.txt == "m"