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

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: D = None
        self.t: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

j = A("j")
h = B("h")
d = C("d")
b = D("b")
a = E("a")
n = F("n")
l = D("l")
g = E("g")

j.r = n
j.v = h
j.p = l
h.y = d
h.p = d
h.o = n
d.x = j
d.z = b
d.t = n
b.p = d
b.z = j
a.u = l
n.s = b
l.p = d
l.z = j
g.u = b
assert d.z.p.x.v.o.s.z.r.txt == "
class A:
    def __init__(self, txt: str):
        self.r: F = None
        self.v: B = None
        self.p: D = None
        self.txt = txt

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

class C:
    def __init__(self, txt: str):
        self.x: A = None
        self.z: D = None
        self.t: F = None
        self.txt = txt

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

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

class F:
    def __init__(self, txt: str):
        self.s: D = None
        self.txt = txt

j = A("j")
h = B("h")
d = C("d")
b = D("b")
a = E("a")
n = F("n")
l = D("l")
g = E("g")

j.r = n
j.v = h
j.p = l
h.y = d
h.p = d
h.o = n
d.x = j
d.z = b
d.t = n
b.p = d
b.z = j
a.u = l
n.s = b
l.p = d
l.z = j
g.u = b
assert d.z.p.x.v.o.s.z.r.txt == "n"