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

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

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.w: F = None
        self.q: D = None
        self.z: E = None
        self.r: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: F = None
        self.r: F = None
        self.s: D = None
        self.v: D = None
        self.o: C = None
        self.t: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: A = None
        self.r: D = None
        self.o: A = None
        self.v: E = None
        self.z: E = None
        self.w: D = None
        self.txt = txt

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

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

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

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

class D:
    def __init__(self, txt: str):
        self.t: F = None
        self.w: F = None
        self.q: D = None
        self.z: E = None
        self.r: A = None
        self.txt = txt

class E:
    def __init__(self, txt: str):
        self.y: F = None
        self.r: F = None
        self.s: D = None
        self.v: D = None
        self.o: C = None
        self.t: F = None
        self.txt = txt

class F:
    def __init__(self, txt: str):
        self.x: A = None
        self.r: D = None
        self.o: A = None
        self.v: E = None
        self.z: E = None
        self.w: D = None
        self.txt = txt

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

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