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

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.r: A = None
        self.x: B = None
        self.u: A = None
        self.txt = txt

l = A("l")
n = B("n")
k = C("k")
i = D("i")
m = E("m")
d = F("d")
c = F("c")
j = C("j")

l.r = j
n.y = i
n.w = i
k.u = c
i.z = m
i.t = m
i.v = n
i.o = d
m.z = n
m.v = i
m.r = d
m.p = k
d.w = l
d.r = l
d.u = l
d.x = n
c.w = l
c.r = l
c.u = l
c.x = n
j.u = d
assert m.r.r.r.u.w.r.u.w.txt == "
class A:
    def __init__(self, txt: str):
        self.r: C = None
        self.txt = txt

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

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

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

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

class F:
    def __init__(self, txt: str):
        self.w: A = None
        self.r: A = None
        self.x: B = None
        self.u: A = None
        self.txt = txt

l = A("l")
n = B("n")
k = C("k")
i = D("i")
m = E("m")
d = F("d")
c = F("c")
j = C("j")

l.r = j
n.y = i
n.w = i
k.u = c
i.z = m
i.t = m
i.v = n
i.o = d
m.z = n
m.v = i
m.r = d
m.p = k
d.w = l
d.r = l
d.u = l
d.x = n
c.w = l
c.r = l
c.u = l
c.x = n
j.u = d
assert m.r.r.r.u.w.r.u.w.txt == "l"