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

class B:
    def __init__(self, txt: str):
        self.p: F = None
        self.x: F = None
        self.v: F = None
        self.r: D = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.p: F = None
        self.x: F = None
        self.v: F = None
        self.r: D = None
        self.txt = txt

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

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

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

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

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

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