class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.p: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.x: D = None
        self.w: F = None
        self.p: D = None
        self.y: E = None
        self.txt = txt

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

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

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

g = A("g")
a = B("a")
l = C("l")
n = D("n")
m = E("m")
e = F("e")
i = F("i")
b = B("b")
c = A("c")

g.r = i
g.p = i
a.u = n
l.z = m
l.y = m
l.x = n
l.p = n
l.w = i
n.o = m
n.r = b
m.t = i
m.r = i
e.z = l
e.o = l
e.t = m
e.p = m
e.x = i
i.z = l
i.o = l
i.t = m
i.p = m
i.x = e
b.u = n
c.r = e
c.p = i
assert m.r.o.y.r.o.z.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.p: F = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.z: E = None
        self.x: D = None
        self.w: F = None
        self.p: D = None
        self.y: E = None
        self.txt = txt

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

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

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

g = A("g")
a = B("a")
l = C("l")
n = D("n")
m = E("m")
e = F("e")
i = F("i")
b = B("b")
c = A("c")

g.r = i
g.p = i
a.u = n
l.z = m
l.y = m
l.x = n
l.p = n
l.w = i
n.o = m
n.r = b
m.t = i
m.r = i
e.z = l
e.o = l
e.t = m
e.p = m
e.x = i
i.z = l
i.o = l
i.t = m
i.p = m
i.x = e
b.u = n
c.r = e
c.p = i
assert m.r.o.y.r.o.z.txt == "m"