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

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

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

c = A("c")
f = B("f")
g = C("g")
i = D("i")
h = E("h")
n = F("n")

c.z = g
c.u = g
f.p = h
g.o = i
i.v = h
h.w = f
h.v = c
n.s = i
n.t = i
assert g.o.v.v.z.txt == "
class A:
    def __init__(self, txt: str):
        self.z: C = None
        self.u: C = None
        self.txt = txt

class B:
    def __init__(self, txt: str):
        self.p: E = None
        self.txt = txt

class C:
    def __init__(self, txt: str):
        self.o: D = None
        self.txt = txt

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

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

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

c = A("c")
f = B("f")
g = C("g")
i = D("i")
h = E("h")
n = F("n")

c.z = g
c.u = g
f.p = h
g.o = i
i.v = h
h.w = f
h.v = c
n.s = i
n.t = i
assert g.o.v.v.z.txt == "g"