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

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: D = None
        self.z: A = None
        self.v: D = None
        self.r: B = None
        self.txt = txt

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

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

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

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

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

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

class B:
    def __init__(self, txt: str):
        self.t: B = None
        self.s: D = None
        self.z: A = None
        self.v: D = None
        self.r: B = None
        self.txt = txt

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

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

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

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

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

g.v = f
g.s = h
j.t = h
j.r = h
j.s = f
j.v = f
j.z = g
n.s = b
n.y = d
n.v = f
f.z = h
f.r = b
b.p = g
b.s = n
d.o = g
d.t = n
d.z = h
d.w = j
d.r = f
h.t = j
h.r = j
h.s = f
h.v = f
h.z = g
assert g.s.z.s.v.z.s.r.txt == "b"