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

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

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

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

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

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

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

d.z = n
f.v = n
f.x = n
n.r = j
n.s = h
n.y = h
m.v = d
i.z = l
i.p = m
l.y = n
c.v = n
c.x = n
h.y = n
j.v = n
j.x = n
assert d.z.r.x.r.v.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.txt = txt

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

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

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

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

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

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

d.z = n
f.v = n
f.x = n
n.r = j
n.s = h
n.y = h
m.v = d
i.z = l
i.p = m
l.y = n
c.v = n
c.x = n
h.y = n
j.v = n
j.x = n
assert d.z.r.x.r.v.txt == "n"